package com.controller;

import java.io.IOException;
import java.io.PrintWriter;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

//不要忘记写@WebServlet注释
@WebServlet("/Fail")
public class FailServlet extends HttpServlet {

	//重写doGet方法
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		this.doPost(req, resp);
	}

	//重写doPost方法
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		//创建一个out输出流对象
		PrintWriter out = resp.getWriter();
		//打印登录失败的页面
		out.println("<html><head><title>登录失败的界面</title></head>");
    	out.println("<body bgcolor='orange'");
    	out.println("<h1>对不起,用户名或密码错误,请重新输入!<a href='login.html'>重新登录</a></h1>");
    	out.println("</body></html>");
    	//关闭输出流
    	out.close();
	}
		
}
